home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK1.toast / Development Kits (Disc 1) / PCI Driver Development Kit / • Samples / Open Firmware Samples / Minimal sample / NCR.of < prev    next >
Encoding:
Text File  |  1996-08-20  |  4.0 KB  |  100 lines  |  [TEXT/MPS ]

  1.  
  2. \ Open Firmware FCode driver for the NCR 8250S PCI-SCSI Card
  3. \
  4. \ by Monte Benaresh -- February 13, 1995
  5. \
  6. \ Copyright:    © 1994-1995 by Apple Computer, Inc., all rights reserved.
  7. \
  8.  
  9.  
  10. \ This is a minimal FCode driver which simply provides identifying information
  11. \ in its device node, and creates a property in its device node which contains
  12. \ the runtime driver to be loaded into the Mac system heap by the Expansion Bus
  13. \ Manager.
  14.  
  15. \ push arguments on the stack for pci-header:
  16. \    *** THESE MUST MATCH THE CONFIG REGISTERS FOR YOUR    ***
  17. \    *** FCODE TO BE RECOGNIZED BY OPEN FIRMWARE            ***
  18. \    vendor #, device #, class-code = SCSI bus controller
  19.  
  20. tokenizer[  hex  1000 0003 010000  decimal ]tokenizer
  21. pci-header                \ generate proper PCI image header
  22.  
  23.     fcode-version2        \ generate proper FCode header (within PCI image)
  24.  
  25.  
  26.     " AAPL,NCR8250S" device-name                        \ Apple is card vendor
  27.     " scsi" device-type
  28.     " 8250S" model
  29.  
  30. \ generate a "reg" property which lists our configuration space at the start of
  31. \ our assigned space, with 0 size (as required by the PCI Binding Supplement)
  32.  
  33.     0 0 my-space encode-phys
  34.         0 encode-int 0 encode-int encode+ encode+                    \ config space
  35.  
  36. \ The next entry is for the onboard ROM memory space, and is necessary to
  37. \ support if you are using encode-file-reg to encapsulate your runtime
  38. \ driver in a driver-reg property.  This new technique is supported in the
  39. \ Mac ROM A7, and replaces the use of the driver property to encapsulate
  40. \ runtime drivers in the PCI expansion ROM.
  41.  
  42.     0 0 my-space h# 02000030 or encode-phys
  43.         0 encode-int h# 00008000 encode-int encode+ encode+            \ ROM space
  44.         encode+
  45.     0 0 my-space h# 02000014 or encode-phys
  46.         0 encode-int h# 00000100 encode-int encode+ encode+            \ memory space
  47.         encode+ " reg" property
  48.  
  49. \ generate a "power-consumtion" property which lists standby and full-on power
  50. \ consumtion for various power rails in microwatts; if we don't create this
  51. \ property, Open Firmware will create one by filling in the "unspecified" rail
  52. \ entries from the PRSNT pins (since we know our power consumption, we fill the
  53. \ "unspecified" entries with zeros)
  54.  
  55.     0 encode-int 0 encode-int encode+                                \ "unspecified"
  56.     d# 7500000 encode-int d# 7500000 encode-int encode+ encode+        \ +5V
  57.     0 encode-int 0 encode-int encode+ encode+                        \ +3V
  58.     d# 8100000 encode-int d# 8100000 encode-int encode+ encode+        \ I/O power
  59.     \ remaining entries are 0 and can be omitted
  60.     \ 0 encode-int 0 encode-int encode+ encode+                        \ reserved
  61.     " power-consumption" property
  62.  
  63.  
  64. \ the following properties will be automatically generated for this card:
  65. \    "has-fcode"
  66. \    "vendor-id" - from PCI configuration register
  67. \    "device-id" - from PCI configuration register
  68. \    "revision-id" - from PCI configuration register
  69. \    "class-code" - from PCI configuration register
  70. \    "interrupts" - from PCI configuration register
  71. \    "min-grant" - from PCI configuration register
  72. \    "max-latency" - from PCI configuration register
  73. \    "devsel-speed" - from PCI configuration register
  74. \    "fast-back-to-back" - from PCI configuration register
  75. \    "assigned-addresses"
  76.  
  77. \ we don't need to define any methods here; there is enough information for the
  78. \ runtime driver to be able to locate the card, but a complete FCode implementation
  79. \ would provide boot-time I/O services
  80.  
  81.  
  82. \ include an image of the runtime driver, and have it assigned as the value of a
  83. \ property that the Expansion Bus Manager will read at startup
  84.  
  85. \ the name of the property takes the form, "driver-reg,<company>,<osname>,<isa>"
  86. \ NOTE:    in the following example, the given <osname> (for Macintosh System 7)
  87. \        is preliminary and subject to change
  88.  
  89. \ use encode-file-reg to create a driver-reg… property, which saves space in
  90. \ copies of the device tree that an OS may keep because it contains a pointer to
  91. \ your driver that the OS can use to find the image and copy if from your
  92. \ onboard ROM
  93.  
  94. \ encode-file-reg is now supported in the A7 Mac ROM
  95.     encode-file-reg NCRDriver   " driver-reg,AAPL,MacOS,PowerPC" property
  96.  
  97.  
  98.     fcode-end            \ terminate normal FCode
  99. pci-end                    \ complete the PCI image
  100.